<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>gap控制行与列的边距</title>
</head>

<body>


    <style>
        .grid-container {
            display: grid;
            grid-template-columns: auto auto auto;
            gap: 20px 50px;
        }

        .grid-container>div {
            border: 1px solid black;
            background-color: yellow;
        }
    </style>
    </head>

    <body>

        <h1>gap 属性</h1>

        <p>使用 <em>gap</em> 属性用来设置网格行与列之间的间隙。</p>
        <p>设置行间距为 20px，列间距为 50px：</p>

        <div class="grid-container">
            <div>1</div>
            <div>2</div>
            <div>3</div>
            <div>4</div>
            <div>5</div>
            <div>6</div>
            <div>7</div>
            <div>8</div>
        </div>
    </body>

</html>